package cn.cxy.flashlight

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        FlashUtils.init(this)
        checkbox.setOnCheckedChangeListener { _, isChecked ->
            if (isChecked) {
                FlashUtils.open()
            } else {
                FlashUtils.close()
            }
        }
        checkbox.isChecked = true
    }
}